#include <iostream>
#define N 100

using namespace std;

//printVector = max at (0 1) (1 1)
void read_matrix(int matrix[N][N], int row, int column){
int i, j;
for (i=0;i<row;i++)
    for(j=0;j<column;j++){
        cout<<"m["<<i<<"]["<<j<<"]= ";
        cin>>matrix[i][j];}
}

void printVector(int array[], int elements){
for(int i=0; i<elements; i++){
	cout<<array[i]<<" ";}
	cout<<"\n";
}



int main(){
int row;
int column;
int matrix[N][N];
int max,i,j;
int array[N];
int elements=0;

max=matrix[0][0];

cout<<"Type the number of rows: " ;
cin>>row;

cout<<"Type the number of columns: " ;
cin>>column;

read_matrix(matrix, row, column);

for(i=0;i<row;i++){
    for(j=0;j<column;j++){
        if(max<matrix[i][j]){
            max=matrix[i][j];}
            }
}
for(i=0;i<row;i++){
    for(j=0;j<column;j++){
        if(max==matrix[i][j]){
            array[elements]=i;
            array[elements+1]=j;
            elements += 2;
        }
    }
}
cout<<"The maximum values were found at locations:"<<endl;
printVector(array, elements);

return 0;
}
